package com.wman;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;

import androidx.annotation.Nullable;

/**
 * @ProjectName: wman
 * @Package: com.wman
 * @ClassName: DrawableView
 * @Description: java类作用描述
 * @Author: wman
 * @CreateDate: 2019/11/11 15:59
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/11/11 15:59
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class DrawableView extends View {
    Drawable mDrawable;

    public DrawableView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    {
        mDrawable = new MeshDrawable();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        mDrawable.setBounds(100, 100, getWidth() - 100, getHeight());
        mDrawable.draw(canvas);
    }
}
